<?php


namespace app\index\controller;


use think\Controller;

/**
 * 视图测试
 * Class ViewTest
 * @package app\index\controller
 */
class ViewTest extends Controller
{

    public function index()
    {
        return $this->fetch();
    }

    public function index_view()
    {
        return view("index_view", ['name' => 'thinkphp5']);
    }

    /**
     * 直接渲染内容
     * @return mixed
     */
    public function index_display()
    {
        $context = 'name:{$name}--email:{$email}';
        return $this->display($context, ['name' => '渲染内容', 'email' => '123456@qq.com']);
    }

    /**
     * 模板赋值----assign 方法传参
     */
    public function view_assign_val()
    {
        /*      $this->assign("name", 'assign传值name');
              $this->assign("email", 'assign@qq.com');*/
        $this->assign([
            'name' => 'assign传值name',
            'email' => 'assign001@qq.com',
        ]);
        return $this->fetch();
    }
}